package com.woniuxy.sort.core.controller;


import com.woniuxy.common.CommonResult;
import com.woniuxy.sort.core.mapper.YhMaintainmenuMapper;
import com.woniuxy.sort.core.model.YhMaintainmenu;
import com.woniuxy.sort.core.model.YhServe;
import com.woniuxy.sort.core.service.YhMaintainmenuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author woniuxy
 * @since 2021-06-29
 */
@RestController
@RequestMapping("/yhMaintainmenu")
@Api(tags = "养护一级菜单接口")
public class YhMaintainmenuController {

    @Resource
    private YhMaintainmenuService yhMaintainmenuService;

    @Resource
    private YhMaintainmenuMapper maintainmenuMapper;

    @GetMapping("select")
    @ApiOperation("养护一级菜单")
    public CommonResult selectAll(){
        List<YhMaintainmenu> yhMaintainmenu =  this.yhMaintainmenuService.selectAll();
        return CommonResult.success(yhMaintainmenu);
    }

    @GetMapping("selectByServe/{menuId}")
    @ApiOperation("查询一个养护一级菜单下的服务")
    public CommonResult selectByServe(@PathVariable("menuId") int menuId){
        List<YhServe> yhServes = this.yhMaintainmenuService.selectByServe(menuId);
            return CommonResult.success(yhServes);
    }

}

